package com.yijia.work5.question3;

public class Question3Bean {

    private int sum;

    public Question3Bean() {
        this.sum = 0;
    }

    public int getSum() {
        return sum;
    }

    public void setSum(int sum) {
        this.sum = sum;
    }

    /**
     * 计算1+2+..+n
     * @param n
     * @return
     */
    public int adder(int n){

        for (int i =1;i<=n;i++){
            sum+=i;
        }

        return sum;
    }
}
